Repository navigation
fix(sdk-coin-tia,sdk-coin-zeta): accept tx-level memo in verifyTransaction - #10238
Draft
hitansh-madan wants to merge 2 commits into
Draft
hitansh-madan wants to merge 2 commits into
hitansh-madan wants to merge 2 commits into
Conversation
The web UIs send TIA recipients as a bare address plus a tx-level txParams.memo, and pending-approval re-signs restore intent.memo into txParams.memo via resolveEffectiveTxParams. The verifyTransaction override only read the memo from the address ?memoId= suffix, so any memo-bearing UI withdrawal or approval failed with 'Tx outputs does not match with expected txParams recipients'. Take the expected memo from the ?memoId= suffix, recipient.memo or txParams.memo.value. All declared sources must agree, and empty strings count as absent. A declared memo must match the transaction memo; when none is declared the transaction must not carry one. Ports the sdk-coin-atom fix (COINS-2285). Ticket: COINS-2752
ZETA carries the same suffix-only verifyTransaction override as TIA, so web UI withdrawals (bare address plus tx-level txParams.memo) and pending-approval re-signs of memo-bearing transfers failed with 'Tx outputs does not match with expected txParams recipients'. Take the expected memo from the ?memoId= suffix, recipient.memo or txParams.memo.value. All declared sources must agree, and empty strings count as absent. A declared memo must match the transaction memo; when none is declared the transaction must not carry one. Ports the sdk-coin-atom fix (COINS-2285). Ticket: COINS-2752
Contributor
Contributor
|
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
TIA withdrawals from the web UIs (bitgo-ui, bitgo-retail) fail client-side with
Tx outputs does not match with expected txParams recipientswhenever a memo is entered. Approving a memo-bearing TIA withdrawal from pending approvals fails the same way. ZETA has the identical override and the same failure.Reported in prod: wallet
6706ba1fef768ea6b4b61416fad307d9sentrecipients: [{address: <bare celestia1…>}]plusmemo: "0". Wallet-platform built the tx with memo0, and the SDK rejected it before signing.Root cause
Tia.verifyTransactionandZeta.verifyTransaction(from #9944 / CSHLD-1780) compare{address, amount, memo}againstexplainTransaction().outputs, but take the recipient memo only from the?memoId=address suffix:txParams.memo(isAddressMemoRequiredis false for cosmos coins).resolveEffectiveTxParamsrestoresintent.memointotxParams.memo.In both cases the tx output has a memo, the expected recipient has none, and
_.isEqualfails. The API shape (addr?memoId=X) passes, which is why #9944 looked correct from the API side.Fix
Port the
sdk-coin-atomverifier (#10113, COINS-2285) tosdk-coin-tia/src/tia.tsandsdk-coin-zeta/src/zeta.ts:?memoId=suffix,recipient.memo, ortxParams.memo.value.memo: ''from cleared UI fields).No change to wallet-platform: it already builds the memo from
intent.memo(or the suffix when there's no intent memo), rejects conflicts, and never injects a default memo. No UI code change; the UIs need an SDK bump after release.Behaviour
txParams.memomatching the tx (web UI)txParams.memonot matching the txaddr?memoId=X(API)txParams.memoconflictmemo: '', tx without memointent.memoTests
New cases in
sdk-coin-tia/test/unit/tia.tsandsdk-coin-zeta/test/unit/zeta.ts:resolveEffectiveTxParams→ passesExisting cases unchanged, including "recipient has no memoId but the tx has one" (now the undeclared-memo case).
Verification
mocha 'test/unit/**/*.ts'insdk-coin-tiamocha 'test/unit/**/*.ts'insdk-coin-zetatsc --build modules/sdk-coin-tia modules/sdk-coin-zetaeslint --quiet+prettier --checkon changed filesOut of scope
CosmosCoin; as written it would bring this bug to every Cosmos coin. It should be closed or reworked to this logic.CosmosCoinchanges behaviour for coins that currently ignore memos; separate change.Ticket: COINS-2752